<?php
/**
 * Created by PhpStorm.
 * User: Vito
 * Date: 2022/5/19
 * Time: 15:08
 */

namespace app\admin\controller\v1;

use app\admin\controller\BaseController;
use app\logic\DashboardLogic;
use app\service\HttpService;
class Dashboard extends BaseController
{
    protected $name = '仪表盘';

    protected $methodName = [
        'index' => '%s',
        'getAllCabinet' =>'获取快递柜使用状态'
    ];

    protected function initialize()
    {
        $this->logic = new DashboardLogic();
    }

    public function index()
    {
        $response = $this->logic->admin();

        return success($response);
    }
    // 获取快递柜使用状态
    public function getAllCabinet(){
        $http = new HttpService;
        $url  = 'http://expressbox.liuchaoai.com/lockboxapi/addons/lockers/Order/getAllCabinet';
        // $url = 'http://127.0.0.1:8011/addons/lockers/Order/getAllCabinet';
        
        $res = $http->senHTTP($url, null);
        $arr = json_decode($res); 
        return success($arr);
    }
}